package com.xuecheng.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.xuecheng.api.order.model.dto.OrdersDTO;
import com.xuecheng.api.order.model.vo.PayResultModel;
import com.xuecheng.api.order.model.vo.QueryOrderModel;
import com.xuecheng.common.domain.page.PageRequestParams;
import com.xuecheng.common.domain.page.PageVO;
import com.xuecheng.order.entity.Orders;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Map;

/**
 * <p>
 * 订单 服务类
 * </p>
 *
 * @author itcast
 * @since 2021-05-21
 */
public interface OrdersService extends IService<Orders> {

    /**
     * 根据课程发布ID生成课程支付订单
     *
     * @param coursePubId
     * @return
     */
    OrdersDTO createOrModifyOrder(Long coursePubId, String userName);

    /**
     * 支付通知并发送事务消息
     *
     * @param xmlPayResult
     * @return
     */
    String notifyPayResult(String xmlPayResult);

    /**
     * 订单支付通知执行本地事务修改订单的状态
     *
     * @param resultModel
     */
    void successPayment(PayResultModel resultModel);

    /**
     * 刷新支付状态
     *
     * @param orderNo
     * @return
     */
    Map<String,Object> refreshPayResult(String orderNo);

    /**
     * 分页查询我的订单
     * @param params
     * @param model
     * @param userName
     * @return
     */
    PageVO<OrdersDTO> queryOrderList(PageRequestParams params, QueryOrderModel model, String userName);
}
